package com.zygh.lz.controller;


import com.zygh.lz.entity.Gatecard;
import com.zygh.lz.service.impl.GatecardServiceImpl;
import com.zygh.lz.stapprove.SysPcLog;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/Gatecard")
public class GatecardController {

    @Resource
    private GatecardServiceImpl gatecardService;

    @ApiOperation("查询所有记录")
    @GetMapping("list")
    public List<Gatecard> listAll() {
        return gatecardService.listAll();
    }


    @ApiOperation("根据主键查询")
    @GetMapping("getById")
    public Gatecard getById(Integer id) {
        return gatecardService.getById(id);
    }

    @ApiOperation("新增，忽略null字段")
    @PostMapping("insert")
    //@SysPcLog(module = "新增出勤记录",operation = "新增")
    public int insert(@RequestBody Gatecard gatecard) {
        return gatecardService.insertIgnoreNull(gatecard);
    }

    @ApiOperation("修改，忽略null字段")
    @PostMapping("update")
    //@SysPcLog(module = "修改出勤记录",operation = "修改")
    public int update(@RequestBody Gatecard gatecard) {
        return gatecardService.updateIgnoreNull(gatecard);
    }

    @ApiOperation("删除记录")
    @PostMapping("delete")
    //@SysPcLog(module = "删除出勤记录",operation = "删除")
    public int delete(@RequestBody Gatecard gatecard) {
        return gatecardService.delete(gatecard);
    }

}